﻿using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using Aspose.Cells;

namespace Small.Excel
{
 public   interface IExcelHelper
    {

     /// <summary>
     /// 写入内容
     /// </summary>
     /// <typeparam name="T">泛型</typeparam>
     /// <param name="source">数据源</param>
     /// <param name="options">Sheet选项</param>
     /// <param name="fields">写入字段名称</param>
     void Write<T>(IQueryable<T> source, ExcelSheetOptions options, Expression<Func<T,Object>> [] fields=null);
     /// <summary>
     /// 导出Excel
     /// </summary>
     /// <typeparam name="T">泛型</typeparam>
     /// <param name="path">模板路径</param>
     /// <param name="fileName">导出之后名称</param>
     void Export(HttpContext context, string fileName, SaveFormat format = SaveFormat.Xlsx);
     void Export(string fileName, SaveFormat format=SaveFormat.Xlsx);
     void Export(Stream stream, SaveFormat format=SaveFormat.Xlsx);
     /// <summary>
     /// 导入Excel
     /// </summary>
     /// <typeparam name="T">泛型</typeparam>
     /// <param name="path">导入文件路径</param>
     /// <param name="options">Sheet选项</param>
     /// <param name="fields">字段</param>
     /// <returns></returns>
     IQueryable<T> Import<T>(ExcelSheetOptions options, Expression<Func<T, Object>>[] fields=null) where T : new();

     /// <summary>
     /// 导入Excel
     /// </summary>
     /// <param name="options">Sheet选项</param>
     /// <returns></returns>
     DataTable Import(ExcelSheetOptions options);
    }
}
